package threads.producer.consumer;

/**
 * 生产者
 */
public class Producer implements Runnable {

    private Store store;

    public Producer(Store store) {
        this.store = store;
    }

    @Override
    public void run() {
        for (int i = 0; i < 5; i++) {
            try {
                String product = String.format("最新款 %d 号手机", i+1);
                store.setProduct(product);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
